package com.yousu.dashijixm.config;

import com.yousu.dashijixm.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author: YouSu
 *
 * 拦截器配置类
 *
 * @Version: 1.0
 * @CreateTime: 2023-11-19  10:43
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    private LoginInterceptor loginInterceptor;
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //注册拦截器
        registry.addInterceptor(loginInterceptor)
                .excludePathPatterns("/user/login","/user/register");//登录和注册接口放行
    }


}
